/* 
 * File: AndroidPixmap
 * Created: 13-JUN-2011
 * Author: Colin Gall-McDaid
 * 
 * Description: Android implementation of the Pixmap interface. Stores a bitmap
 * instance and it's format.
 */
package com.gallsoft.games.framework.impl;

import android.graphics.Bitmap;

import com.gallsoft.games.framework.Graphics.PixmapFormat;
import com.gallsoft.games.framework.Pixmap;


public class AndroidPixmap implements Pixmap {

    protected Bitmap bitmap;
    private PixmapFormat format;
    
    /**
     * Constructor.
     * 
     * @param bitmap the bitmap
     * @param format bitmap format
     */
    public AndroidPixmap(Bitmap bitmap, PixmapFormat format) {
        this.bitmap = bitmap;
        this.format = format;
    }
    
    /**
     * Get the bitmap width
     * 
     * @return bitmap width
     */
    public int getWidth() {
        return bitmap.getWidth();
    }

    /**
     * Get the bitmap height
     * 
     * @return bitmap height
     */
    public int getHeight() {
        return bitmap.getHeight();
    }

    /**
     * Get the bitmap format
     * 
     * @return bitmap format
     */
    public PixmapFormat getFormat() {
        return format;
    }
   
    /**
     * Dispose of a bitmap
     */
    public void dispose() {
        bitmap.recycle();
    }

}
